package com.atxiaodei.springbootrabbitmqfanoutconsumer.service.topic;

import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.stereotype.Component;

/**
 * @ClassName TopicEmailConsumer
 * @Deacription TODO
 * @Author 诸葛孔暗
 * @Date 2021/3/23 15:37
 * @Version 1.0
 **/
@Component
@RabbitListener(bindings =@QueueBinding(
        value = @Queue(
                value = "topic.email.queue",// 设置队列
                durable="true", //是否持久化设置
                autoDelete = "false"),// 是否自动删除

        exchange = @Exchange(
                value = "topic_order_exchange", // 声明一个交换机名称
                durable="true",
                autoDelete = "false",
                type = ExchangeTypes.TOPIC), // // 这里是确定的rabbitmq模式是： TOPIC主题模式
        key = "*.email.#"//topic 主题设置
))
public class TopicEmailConsumer {

    @RabbitHandler
    public void reviceMessage(String message){
        System.out.println("email TOPIC 接收到消息：->"+message);
    }

}
